ports/target: don't crash on transport to an uninitialized bridge#84
Conversation
A QemuTargetSocket's bridge is only wired up to its QEMU instance once init()/init_with_mr() runs. Before that, m_inst is null and the socket cannot service a transaction. Nothing stops a transaction from arriving early, though: a gs::loader loads its image at end_of_elaboration, and that access can be routed by the router to a bridge that hasn't been initialized yet. b_transport then dereferences the null m_inst and segfaults. Bail out early with TLM_OK_RESPONSE when the bridge is uninitialized so the access is a harmless no-op instead of a crash. Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
|
CC (For some reason, I'm not allowed to ask for reviews) |
But does that indicate some kind of misconfiguration that we shouldn't try to support? Or just some configuration that we should support that none of the tests expose? |
I agree, this is very strange - why is (e.g. the loader) trying to load to a qemu target like this? |
I agree on that, when we load to a qemu device very early, most of time this means we have an issue in the configurations of one or more target sockets, so I would prefer to SCP_FATAL with a meaningful message in this case instead of silently return a TLM OK response. |
Indeed, rethinking this, a silent ignore doesn't seem like the best option. I'll close the MR for now (the issue I was seeing was already resolved with another PR) |
A QemuTargetSocket's bridge is only wired up to its QEMU instance once
init()/init_with_mr() runs. Before that, m_inst is null and the socket
cannot service a transaction.
Nothing stops a transaction from arriving early, though: a gs::loader
loads its image at end_of_elaboration, and that access can be routed by
the router to a bridge that hasn't been initialized yet. b_transport
then dereferences the null m_inst and segfaults.
Bail out early with TLM_OK_RESPONSE when the bridge is uninitialized so
the access is a harmless no-op instead of a crash.
Signed-off-by: Matheus Tavares Bernardino matheus.bernardino@oss.qualcomm.com